package com.link2room.cms.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author sqj88
 * @date 2017/12/1 16:59
 */
@Entity
@Table(name = "article_base")
@DynamicInsert
public class ArticleBase extends BaseEntity{
    private String articleId;
    private String categoryCode;
    private String autoAudit;
    private String articleType;

    @Basic
    @Column(name = "article_id", nullable = false, length = 64)
    public String getArticleId() {
        return articleId;
    }

    public void setArticleId(String articleId) {
        this.articleId = articleId;
    }

    @Basic
    @Column(name = "category_code", nullable = false, length = 32)
    public String getCategoryCode() {
        return categoryCode;
    }

    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }

    @Basic
    @Column(name = "auto_audit",  length = 2)
    public String getAutoAudit() {
        return autoAudit;
    }

    public void setAutoAudit(String autoAudit) {
        this.autoAudit = autoAudit;
    }

    @Basic
    @Column(name = "article_type",  length = 642)
    public String getArticleType() {
        return articleType;
    }

    public void setArticleType(String articleType) {
        this.articleType = articleType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ArticleBase that = (ArticleBase) o;

        if (articleId != null ? !articleId.equals(that.articleId) : that.articleId != null) return false;
        if (categoryCode != null ? !categoryCode.equals(that.categoryCode) : that.categoryCode != null) return false;
        if (autoAudit != null ? !autoAudit.equals(that.autoAudit) : that.autoAudit != null) return false;
        return articleType != null ? articleType.equals(that.articleType) : that.articleType == null;
    }

    @Override
    public int hashCode() {
        int result = articleId != null ? articleId.hashCode() : 0;
        result = 31 * result + (categoryCode != null ? categoryCode.hashCode() : 0);
        result = 31 * result + (autoAudit != null ? autoAudit.hashCode() : 0);
        result = 31 * result + (articleType != null ? articleType.hashCode() : 0);
        return result;
    }
}
